<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class UserAsksFor extends Model
{
    use HasFactory;

    use SoftDeletes;

    protected $table="user_asks_for";

    public $timestamps = true;

    protected $guarded = [];

    public static function createParams($params)
    {
        return self::create($params);
    }

    public static function asksForList($type,$province)
    {
        return self::where(['request_type'=>$type,'province'=>$province])->get()->toArray();
    }

    public function userAsksFor()
    {
        return $this->belongsTo(WxUser::class,'uid','id');
    }
}
